package moltencore.network.game;

import moltencore.config.Config;
import moltencore.network.game.strategy.*;
import moltencore.game.Game;

public class StrategyFactory {
	private Game game;
	private GameLobby lobby;

	private JoinGameStrategy joinGame;
	private JoinTeamStrategy joinTeam;
	private StartGameStrategy startGame;
	private ReadyToPlayStrategy readyToPlay;
	private CannonRotateStartStrategy cannonRotateStart;
	private CannonRotateEndStrategy cannonRotateEnd;
	private CannonFireStrategy cannonFire;

	public StrategyFactory(Game game, GameLobby lobby) {
		this.game = game;
		this.lobby = lobby;
	}

	public JoinGameStrategy getJoinGameStrategy() {
		if(joinGame != null) {
			return joinGame;
		}
		joinGame = new JoinGameStrategy(game, lobby);
		return joinGame;
	}

	public JoinTeamStrategy getJoinTeamStrategy() {
		if(joinTeam != null) {
			return joinTeam;
		}
		joinTeam = new JoinTeamStrategy(lobby);
		return joinTeam;
	}

	public StartGameStrategy getStartGameStrategy() {
		if(startGame != null) {
			return startGame;
		}
		startGame = new StartGameStrategy(game, lobby);
		return startGame;
	}

	public ReadyToPlayStrategy getReadyToPlayStrategy() {
		if(readyToPlay != null) {
			return readyToPlay;
		}
		readyToPlay = new ReadyToPlayStrategy(game);
		return readyToPlay;
	}

	public CannonRotateStartStrategy getCannonRotateStartStrategy() {
		if(cannonRotateStart != null) {
			return cannonRotateStart;
		}
		cannonRotateStart = new CannonRotateStartStrategy(game);
		return cannonRotateStart;
	}

	public CannonRotateEndStrategy getCannonRotateEndStrategy() {
		if(cannonRotateEnd != null) {
			return cannonRotateEnd;
		}
		cannonRotateEnd = new CannonRotateEndStrategy(game);
		return cannonRotateEnd;
	}

	public CannonFireStrategy getCannonFireStrategy() {
		if(cannonFire != null) {
			return cannonFire;
		}
		cannonFire = new CannonFireStrategy(game);
		return cannonFire;
	}
}
